/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package utilidades;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Richard
 */
public class Validaciones {

    public static boolean cadenasStringValidas(String... valores) {
        for (String cadena : valores) {
            if ((cadena == null) || (cadena.equals("")) || cadena.isEmpty()) {
                return false;
            }
        }
        return true;
    }

    public static boolean esNumero(String... valores) {
        for (String cadena : valores) {
            for (int i = 0; i < cadena.length(); i++) {
                if (!Character.isDigit(cadena.charAt(i))) {
                    return false;
                }
            }
        }
        return true;
    }

    public static Date pasarTextoAfecha(String fecha) throws ParseException {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");

        try {

            return df.parse(fecha);

        } catch (ParseException ex) {
        }

        return null;
    }
}
